import React, { useState } from 'react';
import"./PromotedSon.scss"
import { Button ,message} from 'antd'
import {useNavigate} from 'react-router-dom'
import{useSelector}from 'react-redux'
import * as service from '../../../../api/promoted'
interface Props{

}
function PromotedSon(props:Props) {

    let navigate = useNavigate()
    let [role1,setRole] = useState('')
    let obj:any = useSelector((state:any)=>state.promotedSonReducer)
    let change =(e:any)=>{
        setRole(e.target.value)
    }
    let fanhui = ()=>{
        navigate(-1)
    }
    let baocun = async()=>{
        obj.role = role1
        // let res = await service.peomoted_zhuanzheng(obj)
        navigate('/index/permoted')
        message.success({content:'转正成功'})
    }
    return (
        <div className='promotedSon'> 
            <div className="title">
                转正信息
            </div>
            <div className="middle">
                <div className="item">
                    <div className="name">
                        姓名 : {obj?.name}
                    </div>
                    <div className="Job_No">
                        工号 : {obj?.Job_No}
                    </div>
                </div>
                <div className="item">
                    <div className="Certificate">
                        证件号码 : {obj?.Certificate}
                    </div>
                    <div className="iphone">
                        手机号 : {obj?.iphone}
                    </div>
                </div>
                <div className="item">
                    <div className="role">
                        工作性质 : <input type="text" value={role1} onChange={(e)=>{change(e)}}/>
                    </div>
                    <div className="department">
                        部门 : {obj?.department}
                    </div>
                </div>
                <div className="item">
                    <div className="post">
                        岗位 : {obj?.post}
                    </div>
                    <div className="trial">
                        试用期 : {obj?.trial}
                    </div>
                </div>
                <div className="item">
                    <div className="time">      
                        入职时间 : {obj?.time}
                    </div>
                    <div className="promoted1">
                        转正时间 : {obj?.promoted1}
                    </div>
                </div>
            </div>
            <div className="xiamian">
            <Button type="primary" onClick={()=>{fanhui()}}>返回</Button>
                &emsp;
                &emsp;
                &emsp;
            <Button type="primary" onClick={()=>{baocun()}}>保存</Button>
            </div>
        </div>
    );
}

export default PromotedSon;